package com.csap.framework.apidoc.admin.web;

import com.csap.framework.annotation.apidoc.ApiOperation;
import com.csap.framework.annotation.apidoc.ApiProperty;
import com.csap.framework.apidoc.admin.model.PushSuccess;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import com.csap.framework.annotation.apidoc.Description;
import com.csap.framework.apidoc.admin.entity.ApiDocEntity;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.csap.framework.annotation.ResponseAdvice;
import com.csap.framework.annotation.apidoc.Api;
import com.csap.mybatisplus.extension.service.web.BaseController;
import com.csap.framework.apidoc.admin.service.ApiDocService;
import com.csap.framework.apidoc.admin.model.ApiDocModel;

import java.util.List;

/**
 * <p>
 * 文档管理信息
 * </p>
 *
 * @author
 * @dateTime
 */
@RequestMapping(value = "/api/apiDoc")
@ResponseAdvice
@Api(description = "文档管理信息", value = "文档管理信息")
@RestController
@Description(value = "文档管理信息Controller")
public class ApiDocController extends BaseController<ApiDocService, ApiDocEntity, ApiDocModel, Long> {

    @ApiOperation(value = "刷新文档")
    @PostMapping("flushDoc")
    public Boolean flushDoc(@RequestBody List<Long> docIds) {
        return getService().flushDoc(docIds);
    }

    @ApiOperation(value = "发布文档")
    @ApiProperty(value = "文档ID", name = "id", required = true)
    @PostMapping("publishDoc")
    public String publishDoc(@RequestParam Long id) {
        return getService().publishDoc(id);
    }

    @ApiOperation(value = "是否发布成功")
    @GetMapping("publishSuccess")
    public PushSuccess publishSuccess(@RequestParam String id) {
        return getService().publishSuccess(id);
    }
}
